/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dnbW.entityW;

import java.util.ArrayList;
import java.util.List;

/**
 * Encapsulates a set of conditions grouped together by an AND/OR operator
 * @author truongbaquan
 */
public class ConditionGroup {
    public enum Operator {And, Or};

    // <editor-fold desc="Operator">
    public Operator operator;

    public Operator getOperator() {
        return operator;
    }

    public void setOperator(Operator operator) {
        this.operator = operator;
    }
    // </editor-fold>

    // <editor-fold desc="Conditions">
    List<Condition> conditions = new ArrayList<Condition>(5);

    public List<Condition> getConditions() {
        return conditions;
    }
    // </editor-fold>

    public ConditionGroup() {
        this(Operator.And);
    }

    public ConditionGroup(Operator operator) {
        this.operator = operator;
    }

    public boolean addCondition(Condition condition) {
        return this.conditions.add(condition);
    }

    public boolean removeCondition(Condition condition) {
        return this.conditions.remove(condition);
    }
}
